const formatTime = dateStr => {
  const date = new Date(dateStr)
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}`
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : `0${n}`
}

const formatDate=(dateStr)=> {
  const date = new Date(dateStr);
  const year = date.getFullYear();
  const month = date.getMonth() + 1; // 月份从0开始
  return `${year}年${month.toString().padStart(2, '0')}月`; // 如果你想保持两位数月份
}

const globalUrl=(url)=>{
  return "https://32k190i134.goho.co/community/"+url;
}

module.exports = {
  formatTime,
  globalUrl,
  formatDate
}
